/*
 * 9.3.cpp
 *
 *  Created on: 2012-5-18
 *      Author: jawinton
 */

#include <cstring>
#include <cstdio>
#include <cstdlib>

#define SIZE 10

int common (int m, int n) {
	if (m==n) return m;
	else if (m > n) return common(m/2, n);
	else return common(m, n/2);
}

int main (void) {
	int m, n;
	scanf("%d %d", &m, &n);
	printf("%d\n", common(m, n));
	return 0;
}
